import { IUser } from '@/store'
import request from '@/utils/https'

// 微信登录
export function login(code: string) {
  return request<{ token: string }>({
    url: '/weChatLogin',
    method: 'post',
    params: {
      code
    }
  })
}

export function getUser() {
  return request<IUser>({
    url: '/userInfo',
    method: 'get'
  })
}
export function updateUser(data: any) {
  return request<any[]>({
    url: '/updateUser',
    method: 'post',
    data
  })
}

export function uploadFile(filePath: string) {
  return request({
    url: '/file/upload',
    filePath,
    method: 'post',
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}
